<template>
    <div>
        <el-button type="primary" class="backbtn" size="small" @click="backuserlist">返回用户列表</el-button>
        <el-table v-loading="loading" :data="userInfo"  ref="multipleTable" tooltip-effect="dark" border style="width: 100%">
            <el-table-column prop="id" label="ID" width="55">
            </el-table-column>
            <el-table-column label="用户信息" width="100">
                 <template v-slot="scope">
                        <div class="user_head_url">
                            <img :src="scope.row.head_url">
                        </div>
                        <div class="user_username">{{ scope.row.nickname }}</div>
                    </template>
            </el-table-column>
            <el-table-column prop="stored_money" label="余额">
                <template v-slot="scope">
                    <div class="yue">
                        <div>{{ format_money(scope.row.stored_money) }}</div>
                        <div>
                            <el-button @click="moneyFormVisible = true" round type="warning" size="mini">充值</el-button>
                            <el-button @click="moneyForm_Visible = true" round type="danger" size="mini">扣除</el-button>
                        </div>
                    </div>
                    <el-dialog
                        title="微信用户充值余额"
                        :visible.sync="moneyFormVisible"
                        width="30%"
                        >
                        <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                           <el-form-item label="用户昵称:" prop="pass">
                             <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="账户数量:">
                             <el-input type="text" v-model="scope.row.stored_money / 100" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="充值余额:" prop="age">
                             <el-input v-model.number="moneyChong.money"></el-input>
                           </el-form-item>
                         </el-form>
                        <span slot="footer" class="dialog-footer">
                          <el-button @click="moneyFormVisible = false">取 消</el-button>
                          <el-button type="primary" @click="yuEChong(scope.row.uuid)">确 定</el-button>
                        </span>
                    </el-dialog>
                    <el-dialog
                        title="微信用户扣除余额"
                        :visible.sync="moneyForm_Visible"
                        width="30%"
                        >
                        <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                           <el-form-item label="用户昵称:" prop="pass">
                             <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="账户数量:">
                             <el-input type="text" v-model="scope.row.stored_money / 100" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="扣除余额:" prop="age">
                             <el-input v-model.number="moneyChong.money_k"></el-input>
                           </el-form-item>
                         </el-form>
                        <span slot="footer" class="dialog-footer">
                          <el-button @click="moneyForm_Visible = false">取 消</el-button>
                          <el-button type="primary" @click="yuEKou(scope.row.uuid)">确 定</el-button>
                        </span>
                    </el-dialog>
                </template>
            </el-table-column>
            <!--  -->
            <el-table-column prop="hunjing" label="魂晶">
                <template v-slot="scope">
                    <div class="yue">
                        <div>{{ format_hunjing(scope.row.hunjing) }}</div>
                        <div>
                            <el-button @click="hunJingFormVisible_c = true" type="warning" round size="mini">充值</el-button>
                            <el-button @click="hunJingFormVisible_k = true" type="danger" round size="mini">扣除</el-button>
                            <el-button @click="hunJingFormVisible_t = true" type="success" round size="mini">提现</el-button>
                        </div>
                        <el-dialog
                            title="微信用户充值魂晶"
                            :visible.sync="hunJingFormVisible_c"
                            width="30%"
                            >
                            <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                               <el-form-item label="用户昵称:" prop="pass">
                                 <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                               </el-form-item>
                               <el-form-item label="账户数量:">
                                 <el-input type="text" v-model="scope.row.hunjing" disabled autocomplete="off"></el-input>
                               </el-form-item>
                               <el-form-item label="充值魂晶:" prop="age">
                                 <el-input v-model.number="hunJing.c"></el-input>
                               </el-form-item>
                             </el-form>
                            <span slot="footer" class="dialog-footer">
                              <el-button @click="hunJingFormVisible_c = false">取 消</el-button>
                              <el-button type="primary" @click="hunJingChong(scope.row.uuid)">确 定</el-button>
                            </span>
                        </el-dialog>
                           <el-dialog
                            title="微信用户扣除魂晶"
                            :visible.sync="hunJingFormVisible_k"
                            width="30%"
                            >
                            <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                               <el-form-item label="用户昵称:">
                                 <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                               </el-form-item>
                               <el-form-item label="账户数量:">
                                 <el-input type="text" v-model="scope.row.hunjing" disabled autocomplete="off"></el-input>
                               </el-form-item>
                               <el-form-item label="扣除魂晶:">
                                 <el-input v-model.number="hunJing.k"></el-input>
                               </el-form-item>
                             </el-form>
                            <span slot="footer" class="dialog-footer">
                              <el-button @click="hunJingFormVisible_k = false">取 消</el-button>
                              <el-button type="primary" @click="hunJingKou(scope.row.uuid)">确 定</el-button>
                            </span>
                        </el-dialog>
                        <el-dialog
                            title="微信用户提现魂晶"
                            :visible.sync="hunJingFormVisible_t"
                            width="30%"
                            >
                            <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                               <el-form-item label="用户昵称:" prop="pass">
                                 <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                               </el-form-item>
                               <el-form-item label="账户数量:">
                                 <el-input type="text" v-model="scope.row.hunjing" disabled autocomplete="off"></el-input>
                               </el-form-item>
                               <el-form-item label="提现魂晶:" prop="age">
                                 <el-input v-model.number="hunJing.t"></el-input>
                               </el-form-item>
                             </el-form>
                            <span slot="footer" class="dialog-footer">
                              <el-button @click="hunJingFormVisible_t = false">取 消</el-button>
                              <el-button type="primary" @click="hunJingTi(scope.row.uuid)">确 定</el-button>
                            </span>
                        </el-dialog>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="score" label="赏币">
                <template v-slot="scope">
                    <div class="yue">
                        <div>{{ format_hunjing(scope.row.score)}}</div>
                        <div>
                            <el-button @click="shangBiFormVisible_c = true" type="warning" round size="mini">充值</el-button>
                            <el-button @click="shangBiFormVisible_k = true" type="danger" round size="mini">扣除</el-button>
                        </div>
                    </div>
                    <el-dialog
                        title="微信用户提现赏币"
                        :visible.sync="shangBiFormVisible_c"
                        width="30%"
                        >
                        <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                           <el-form-item label="用户昵称:">
                             <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="账户数量:">
                             <el-input type="text" v-model="scope.row.score" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="充值赏币:">
                             <el-input v-model.number="shangBi.c"></el-input>
                           </el-form-item>
                         </el-form>
                        <span slot="footer" class="dialog-footer">
                          <el-button @click="shangBiFormVisible_c = false">取 消</el-button>
                          <el-button type="primary" @click="shangBiChong(scope.row.uuid)">确 定</el-button>
                        </span>
                    </el-dialog>
                    <el-dialog
                        title="微信用户提现赏币"
                        :visible.sync="shangBiFormVisible_k"
                        width="30%"
                        >
                        <el-form :model="moneyChong" status-icon label-width="100px" class="demo-ruleForm">
                           <el-form-item label="用户昵称:" prop="pass">
                             <el-input type="text" v-model="scope.row.nickname" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="账户数量:">
                             <el-input type="text" v-model="scope.row.score" disabled autocomplete="off"></el-input>
                           </el-form-item>
                           <el-form-item label="扣除赏币:" prop="age">
                             <el-input v-model.number="shangBi.k"></el-input>
                           </el-form-item>
                         </el-form>
                        <span slot="footer" class="dialog-footer">
                          <el-button @click="shangBiFormVisible_k = false">取 消</el-button>
                          <el-button type="primary" @click="shangBiKou(scope.row.uuid)">确 定</el-button>
                        </span>
                    </el-dialog>
                </template>
            </el-table-column>
            <el-table-column prop="address" label="邀请人">
                <template v-slot="scope">
                        <img src=""> <span class="uid">1002</span><span class="ivtName">{{ scope.row.inviter_name }}</span>
                    </template>
            </el-table-column>
            <el-table-column prop="address" label="会员等级">
            </el-table-column>
            <el-table-column prop="telephone" label="手机号">
            </el-table-column>
            <el-table-column prop="address" label="是否代理">
                <template v-slot="scope">
                      <el-button v-if="scope.row.is_daili == true" size="mini" type="success" round>是</el-button>
                      <el-button v-else size="mini" type="danger" round>否</el-button>
                  </template>
            </el-table-column>
            <el-table-column prop="address" label="是否实名">
                  <template v-slot="scope">
                      <el-button v-if="scope.row.is_real == true" size="mini" type="success" round>已实名</el-button>
                      <el-button v-else size="mini" type="danger" round>未实名</el-button>
                  </template>
            </el-table-column>
            <el-table-column prop="address" label="状态">
                 <template v-slot="scope">
                      <el-button v-if="scope.row.state == 0" size="mini" round type="primary">正常</el-button>
                      <el-button v-else size="mini" round type="danger">已禁用</el-button>
                  </template>
            </el-table-column>
            <el-table-column prop="createAt" label="注册时间">
            </el-table-column>
            <el-table-column prop="address" label="操作">
                <template v-slot="scope">
                    <div class="caozuo">
                        <div>
                            <a class="ban" v-if="scope.row.state == 0" @click="ban(scope.row.uuid, true)">禁用</a>
                            <a class="ban" v-else @click="ban(scope.row.uuid, false)">解除禁用</a>
                            <a class="jilu" @click="feeVisible = true">消费记录</a>
                            <a class="jilu" @click="yingkuiVisible = true">盈亏记录</a>
                        </div>
                        <div>
                            <a class="shanggui" @click="shangguiVisible = true">赏柜详情</a>
                            <a>优惠券</a>
                            <a>修改推荐人</a>
                        </div>
                    </div>
                </template>
            </el-table-column>
        </el-table>
        <!-- 消费记录 -->
        <el-dialog width="70%" title="消费记录" :visible.sync="feeVisible">
            <el-input placeholder="会员UID" v-model="searchUid_expense"></el-input>
                <el-date-picker
                    v-model="searchTime_expense"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy 年 MM 月 dd 日"
                    value-format="yyyy-MM-dd">
                  </el-date-picker>
              <button class="sousuo" @click="search_expense"><i class="el-icon-search"></i></button>
          <el-table border :data="expenseData" width="100%">
            <el-table-column property="id" label="ID" width="50"></el-table-column>
            <el-table-column property="name" label="用户信息">
              <template v-slot="scope">
                <div class="expense_userInfo">
                  <div class="expense_head_url">
                      <img :src="scope.row.user.head_url" alt="">
                  </div>
                  <div class="userInfo">
                    <div class="expense_uid">UID: {{ scope.row.user.id }}</div>
                    <div class="expense_nickname">{{scope.row.user.nickname}}</div>
                  </div>
                </div>
              </template>
            </el-table-column>
            <el-table-column property="address" label="奖品信息">
                <template v-slot="scope">
                  <div class="expense_goodInfo">
                    <div class="expense_cover_url">
                        <img :src="scope.row.game.cover_url" alt="">
                    </div>
                    <div class="gameInfo">
                      <div class="expense_gameName">名称:{{ scope.row.game.name }}</div>
                      <div class="expense_price">单价:￥{{ format_money(scope.row.game.price) }}</div>
                      <div class="expense_number">箱号:{{ scope.row.box_num }}</div>
                    </div>
                  </div>
                </template>
            </el-table-column>
            <el-table-column property="num" label="购买数量"></el-table-column>
            <el-table-column property="money" label="商品总价">
              <template v-slot="scope">
                  {{ format_money(scope.row.sum_price)}}
              </template>
            </el-table-column>
            <el-table-column property="address" label="支付明细">
                <template v-slot="scope">
                  <div class="pay_detail">
                     <p>微信:￥{{ format_money(scope.row.weixin) }}</p>
                     <p>余额:{{ format_money(scope.row.money) }}</p>
                     <p>魂晶:{{ format_hunjing(scope.row.hunjing) }}</p>
                     <p>赏币:{{ scope.row.score }}.00</p>
                     <p>优惠券:{{ scope.row.coupon }}.00</p>
                  </div>
                </template>
            </el-table-column>
            <el-table-column property="address" label="类型">
              <template v-slot="scope">
                  <el-button size="mini" type="primary" round>{{ scope.row.game_type_name }}</el-button>
              </template>
            </el-table-column>
            <el-table-column label="支付时间">
                {{ expenseTime }}
            </el-table-column>
            <el-table-column property="orderid" label="订单号">
              <template v-slot="scope">{{ scope.row.orderid }}</template>
            </el-table-column>
            <el-table-column label="操作">
              <template v-slot="scope">
                <el-button size="mini" type="warning" @click="getMoneyRecordGoods(scope.row.uuid)">详情</el-button>
                  <el-dialog
                    width="60%"
                    title="赏品详情"
                    :visible.sync="feeDetailVisible"
                    append-to-body
                    >
                     <el-table v-loading="expense_detail_loading" :data="expenseDetailData">
                      <el-table-column label="赏品信息" width="150">
                        <template v-slot="scope">
                          <div class="expenseDetail_goodsInfo">
                              <img :src="scope.row.display_url" alt="">
                              {{ scope.row.name }}
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column label="商品名称" width="200">
                        <template v-slot="scope">
                            {{ scope.row.name }}
                        </template>
                      </el-table-column>
                      <el-table-column label="回收价值">
                        <template v-slot="scope">
                          <el-button size="mini" type="warning" round>￥{{ format_money(scope.row.recovery_price) }}</el-button>
                        </template>
                      </el-table-column>
                      <el-table-column property="sum_count" label="赏品数量"></el-table-column>
                  </el-table>
                  </el-dialog>
              </template>
            </el-table-column>
          </el-table>
           <el-pagination
            @size-change="handleSizeChange_expense"
            @current-change="handleCurrentChange_expense"
            :current-page="pagenum_expense"
            :page-sizes="[5, 10, 15]"
            :page-size="pagesize_expense"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total_expense">
          </el-pagination>
           
        </el-dialog>
        <el-dialog  width="75%" title="盈亏记录" :visible.sync="yingkuiVisible">
              <el-input placeholder="会员UID" v-model="searchUid_profit"></el-input>
                  <el-date-picker
                      v-model="searchTime_profit"
                      type="date"
                      placeholder="选择日期"
                      format="yyyy 年 MM 月 dd 日"
                      value-format="yyyy-MM-dd">
                    </el-date-picker>
                <button class="sousuo" @click="search_profit"><i class="el-icon-search"></i></button>
            <el-table border :data="profitData">
              <el-table-column property="date" label="日期" width="150"></el-table-column>
              <el-table-column property="name" label="用户信息" width="200">
                <template v-slot="scope">
                  <div class="profit_userInfo">
                      <div class="profit_head_url">
                        <img :src="scope.row.user_head_url" alt="">
                      </div>
                      <div class="profit_user">
                        <div class="profit_uid">UID: {{ scope.row.user_id }}</div>
                        <div class="profit_name">{{scope.row.user_name}}</div>
                      </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="当日充值">
                <template v-slot="scope">
                   <p>后台直冲:￥{{ format_money(scope.row.admin_recharge) }}</p>
                   <p>微信充值:￥{{ format_money(scope.row.wx_recharge) }}</p>
                </template>
              </el-table-column>
              <el-table-column property="address" label="当日消费(不含赏币消费)">
                <template v-slot="scope">
                  <p>一番赏:{{ format_money(scope.row.yifanshang_raffle_cost) }}</p>
                  <p>全局赏:{{ format_money(scope.row.quanjushang_raffle_cost) }}</p>
                  <p>无限赏:{{ format_money(scope.row.wuxianshang_raffle_cost) }}</p>
                </template>
              </el-table-column>
              <el-table-column property="address" label="当日产出">
                  <template v-slot="scope">
                    <p>一番赏:{{ format_money(scope.row.yifanshang_raffle_income) }}</p>
                    <p>全局赏:{{ format_money(scope.row.quanjushang_raffle_income) }}</p>
                    <p>无限赏:{{ format_money(scope.row.wuxianshang_raffle_income) }}</p>
                  </template>
                </el-table-column>
              <el-table-column property="address" label="当日发货赏品价值"></el-table-column>
              <el-table-column property="address" label="当日提现">
                <template v-slot="scope">
                    {{ format_money(scope.row.whole_withdraw / 100) }}
                </template>
              </el-table-column>
              <el-table-column property="whole_raffle_profit" label="当日盈亏(消费-产出)">
                  <template v-slot="scope">
                    {{ format_money(scope.row.whole_raffle_profit)}}
                </template>
              </el-table-column>
            </el-table>
            <el-pagination
              @size-change="handleSizeChange_profit"
              @current-change="handleCurrentChange_profit"
              :current-page="pagenum_profit"
              :page-sizes="[5, 10, 15]"
              :page-size="pagesize_profit"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total_profit">
            </el-pagination>
        </el-dialog>
        <el-dialog width="70%" title="赏柜详情" :visible.sync="shangguiVisible">
           <el-input placeholder="请选择赏品" v-model="searchUid_packages"></el-input>
                <el-date-picker
                     v-model="searchTime_packages"
                     type="date"
                     placeholder="选择日期"
                     format="yyyy 年 MM 月 dd 日"
                     value-format="yyyy-MM-dd">
                   </el-date-picker>
               <button class="sousuo" @click="search_packages"><i class="el-icon-search"></i></button>
          <el-table border :data="packageData">
            <el-table-column property="date" label="赏品信息">
              <template v-slot="scope">
                <div class="package_url">
                  <div class="package_url_img">
                    <img :src="scope.row.good.display_url" alt="">
                  </div>
                  <div class="info">
                    {{ scope.row.good.name }}
                  </div>
                </div>
              </template>
            </el-table-column>
            <el-table-column property="name" label="赏品名称" width="150">
              <template v-slot="scope">
                 <el-button size="mini" type="primary">{{ scope.row.good.game_type }}</el-button>
              </template>
            </el-table-column>
            <el-table-column property="address" label="回收价格">
              <template v-slot="scope">
                 ￥ {{  format_money(scope.row.good.recovery_price) }}
              </template>
            </el-table-column>
            <el-table-column property="address" label="中奖时间" width="200">
              {{ packageTime }}
            </el-table-column>
            <el-table-column property="address" label="商品状态">
              <template v-slot="scope">
                <el-button v-if="scope.row.good.state == 0" type="primary" size="mini" round>待处理</el-button>
                <el-button v-else type="primary" size="mini" round>已处理</el-button>
              </template>
            </el-table-column>
          </el-table>
            <el-pagination
              @size-change="handleSizeChange_packages"
              @current-change="handleCurrentChange_packages"
              :current-page="pagenum_packages"
              :page-sizes="[5, 10, 15]"
              :page-size="pagesize_packages"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total_packages">
            </el-pagination>
        </el-dialog>
    </div>
</template>

<script>
import person from '../../../../api/person'
import banApi from '../../../../api/jurisdiction'
import {format_hunjing, format_money} from "@/utils/format";
export default {
    data() {
    return {
      loading:true,
            expenseData: [],
            expenseDetailData:[],
            profitData: [],
            packageData:[],
            userInfo: [],
            expense_detail_loading: true,
            pagenum_expense: 1,
            pagesize_expense: 5,
            total_expense:0,
            searchTime_expense:null,
            searchUid_expense:null,
            pagenum_profit: 1,
            pagesize_profit: 5,
            total_profit: 0,
            searchTime_profit: null,
            searchUid_profit: null,
            pagenum_packages: 1,
            pagesize_packages: 5,
            total_packages: 0,
            searchTime_packages: null,
            searchUid_packages: null,
            moneyFormVisible: false,
            moneyForm_Visible:false,
            moneyChong: {},
            hunJingFormVisible_c: false,
            hunJingFormVisible_k:false,
            hunJingFormVisible_t:false,
            hunJing: {},
            shangBiFormVisible_c:false,
            shangBiFormVisible_k: false,
            shangBi:{},
            feeVisible: false,
            feeDetailVisible:false,
            yingkuiVisible:false,
            shangguiVisible:false,
        }
  },
    computed: {
      packageTime() {
        let date = ''
        this.packageData.forEach(v => {
          let t = v.createdAt.split('T')
          let t2 = t[1].split('.')
          date = `${t[0]} ${t2[0]}`
        })
        return date
        },
      expenseTime() {
        let date = ''
        this.expenseData.forEach(v => {
          let t = v.createdAt.split('T')
          let t2 = t[1].split('.')
          date = `${t[0]} ${t2[0]}`
        })
        return date
        },
    },
  created() {
        if (this.$route.params.id) {
          this.$store.commit("setUser_uuid",this.$route.params.id)
        }
        this.getUserInfo()
        this.getMoneyRecord()
        this.getProfit()
        this.getPackages()
    },
    methods: {
      format_money,
      format_hunjing,
        backuserlist() {
            this.$router.push("/layout/yonghuguanli/yonghuliebiao")
        },
        getUserInfo() {
              this.userInfo = []
              person.detail({ uuid: localStorage.getItem('user_uuid') }).then((res) => {
              this.loading = false
              this.userInfo.push(res.data.data)
                console.log('用户信息',this.userInfo[0].uuid)
            })
        },
        getMoneyRecord() {
          person.moneyRecord({ user_uuid: localStorage.getItem('user_uuid'),page: this.pagenum_expense, page_size: this.pagesize_expense, date: this.searchTime_expense }).then((res) => {
              console.log('消费记录',res)
              this.expenseData = res.data.data.list
              this.total_expense = res.data.data.sum_count
            }).catch((err) => {
              console.log('消费记录错误', err)
            
            })
        },
      getMoneyRecordGoods(id) {
            this.feeDetailVisible = true
            person.moneyRecordGoods({ order_uuid: id }).then((res) => {
            this.expense_detail_loading = false
            this.expenseDetailData = res.data.data.list
            console.log('消费记录详情',res)
          })
        },
        search_expense() {
                this.getMoneyRecord()
        },
        getProfit() {
          person.yingKuiRecord({ user_uuid: localStorage.getItem('user_uuid'),page: this.pagenum_profit, page_size: this.pagesize_profit, date_start: this.searchTime_profit }).then((res) => {
              console.log('盈亏记录',res)
                this.profitData = res.data.data.days.list
                this.total_profit = res.data.data.days.sum_count
            }).catch((err) => {
              console.log('盈亏记录错误', err)
              
            })
        },
        search_profit() {
                this.getProfit()
        },
        getPackages() {
          person.packages({ user_uuid: localStorage.getItem('user_uuid'),page: this.pagenum_packages, page_size: this.pagesize_packages, date: this.searchTime_packages }).then((res) => {
            console.log('赏柜详情', res)
              this.packageData = res.data.data.list
              this.total_packages = res.data.data.sum_count
            }).catch((err) => {
              console.log('赏柜详情错误', err)
            })
        },
        search_packages() {
           this.getPackages()
        },
        // 操作
        yuEChong(id) {// 余额
          console.log(id, this.moneyChong.money)
            person.moneyRecharge({
                user_uuid: id,
                stored_money: this.moneyChong.money * 100
            }).then((res) => {
              this.$message.success(`已充值${this.moneyChong.money}`)
            }).catch((err) => {
              console.log('错误',err)
            }).finally(res => {
              this.getUserInfo()
              this.moneyFormVisible = false
              this.moneyChong.money = 0
            })
          },
          yuEKou(id) {
            person.moneyRefund({
              user_uuid: id,
              stored_money: this.moneyChong.money_k*100
            }).then((res) => {
              this.$message.success(`已扣除${this.moneyChong.money_k}`)
            }).catch((res) => {
              this.$message.warning("扣除失败")
              console.log(res)
            }).finally(res => {
              this.getUserInfo()
              this.moneyForm_Visible = false
              this.moneyChong.money_k = 0
            })
        },
        hunJingChong(id) {             //魂晶
            person.hunJingrecharge({
                user_uuid: id,
                hunjing: this.hunJing.c*100
            }).then((res) => {
                console.log(res)
                this.$message.success(`已充值魂晶${this.hunJing.c}`)
              }).catch((res) => {
                this.$message.warning("充值失败")
              }).finally(res => {
                this.getUserInfo()
                this.hunJingFormVisible_c = false
                this.hunJing.c = 0
              })
            },
            hunJingKou(id) {
              person.hunJingdeduction({
                user_uuid: id,
                hunjing: this.hunJing.k
              }).then((res) => {
              this.$message.success(`已扣除魂晶${this.hunJing.k}`)
              console.log(res)
              }).catch((err) => {
                this.$message.warning("扣除失败")
              }).finally(res => {
                this.getUserInfo()
                this.hunJingFormVisible_k = false
                this.hunJing.k = 0
              })
          },
          hunJingTi(id) {
            person.hunJingwithdraw({
              user_uuid: id,
              hunjing: this.hunJing.t
            }).then((res) => {
              this.$message.success(`已提现魂晶${this.hunJing.t}`)
                console.log(res)
            }).catch((err) => {
              console.log('提现失败错误',err)
                this.$message.warning("提现失败")
            }).finally(res => {
              this.getUserInfo()
              this.hunJingFormVisible_t = false
              this.hunJing.t = 0
            })
        },
        shangBiChong(id) {
             person.shangBirecharge({ //赏币
                user_uuid: id,
                score: this.shangBi.c
             }).then((res) => {
               this.$message.success(`已充值赏币${this.shangBi.c}`)
                console.log(res)
            }).catch((err) => {
              this.$message.warning("充值失败")
            }).finally(res => {
              this.getUserInfo()
              this.shangBiFormVisible_c = false
              this.shangBi.c =0
            })
        },
        shangBiKou(id) {
             person.shangBideduction({
                user_uuid: id,
                score: this.shangBi.k
             }).then((res) => {
               this.$message.success(`已扣除赏币${this.shangBi.k}`)
                console.log(res)
                console.log(res)
            }).catch((err) => {
              this.$message.warning("扣除失败")
            }).finally(res => {
              this.getUserInfo()
              this.shangBiFormVisible_k = false
              this.shangBi.k = 0
            })
      },
      handleSizeChange_expense(val) {
         this.pagesize_expense = val
      this.getMoneyRecord()
      },
      handleCurrentChange_expense(val) {
          this.pagenum_expense = val
      this.getMoneyRecord()
      },
      handleSizeChange_profit(val) {
      this.pagesize_profit = val
      this.yingKuiRecord()
      },
      handleCurrentChange_profit(val) {
          this.pagenum_profit = val
      this.yingKuiRecord()
      },
      handleSizeChange_packages(val) {
        this.pagesize_packages = val
        this.getPackages()
      },
      handleCurrentChange_packages(val) {
        this.pagenum_packages = val
        this.getPackages()
        
      },
       ban(id, ban) {
              this.$confirm('是否禁用该用户？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                banApi.jinyong({
                  user_uuid: id,
                  disable: ban
                }).then((res) => {
                  console.log('禁用', res)
                  if (ban == true) {
                    this.$message({
                      type: 'success',
                      message: '该用户已被禁用!'
                    });
                  } else {
                    this.$message({
                      type: 'success',
                      message: '已解除禁用!'
                    });
                  }
                  this.getUserInfo()
                })
              }).catch(() => {
                this.$message({
                  type: 'info',
                  message: '已取消'
                });
              });
            },
            }
}
</script>

<style lang="less" scoped>
.el-button:first-child{
  margin-left: 10px !important;
}
::v-deep .el-table .cell {
  text-align: center;
}
.caozuo a{
    display: inline-block;
    padding: 1px 5px;
    margin: 3px ;
    color:white;
    height: 20px;
    font-size: 12px;
    border-radius: 5px;
    background: #409eff;
    cursor: pointer;
}
.caozuo .danger{
    background: #f56c6c;
}
.caozuo .shanggui{
    background: #009688;
}
.caozuo .jilu{
    background: #e6a23c;
}
.backbtn{
    margin-bottom: 20px ;
}
.el-button{
    margin-bottom:7px;
}
.user_head_url {
    width: 60%;
}
.el-input{
  margin-right:20px;
}
.user_head_url img {
    width: 100%;
}
.el-input{
    text-align: center;
    width: 200px;
}
.el-pagination{
  text-align: center;
  margin-top: 20px;
}
.sousuo {
    margin: 6px;
    width: 50px;
    height: 40px;
    background: #009688;
    border: 0;
    color: white;
    font-size: 20px;
    vertical-align: middle;
    text-align: center;
    line-height: 40px;
    border-radius: 4px;
    cursor: pointer;
}
.package_url{
  width:90%;
  height: 80%;
}
.package_url_img{
  float: left; 
  width:60px;
  height: 60px;
}
.package_url_img img{
  width:100%;
  height:100%;
}
.info{
  float: left;
  margin-left: 8px;
  height:60px;
  line-height: 60px;
  margin-left:10px;
}
.expense_userInfo{
  width:90%;
  height: 95%;
}
.expense_head_url,.expense_head_url img{
  float: left;
  width:45px;
  height: 45px;
}
.userInfo{
  float: left;
  margin-left:6px;
  height: 50px;
  font-size: 13px;
}
.expense_uid{
  color:red;
}
.expense_goodInfo{
  width:90%;
  height: 95%;
}
.expense_cover_url,.expense_cover_url img{
  float: left;
  width:45px;
  height: 45px;
}
.gameInfo{
  float: left;
  margin-left:6px;
  height: 50px;
  font-size: 13px;
}
.good_detail{
  width:90%;
  height: 95%;
}
.good_url_detail,.good_url_detail img{
  float: left;
  width:45px;
  height: 45px;
}
.profit_userInfo{
  width:90%;
  height: 95%;
}
.profit_head_url,.profit_head_url img{
  float: left;
  width:45px;
  height: 45px;
}
.profit_user{
  float: left;
  margin-left:6px;
  height: 50px;
  font-size: 13px;
}
.profit_uid{
  color:red;
}
.good_name_detail{
  float: left;
  margin-left:6px;
  height: 50px;
  font-size: 13px;
}
.pay_detail{
  font-size: 13px;
}
.ban {
    background-color: #ff5722 !important;
}
.expenseDetail_goodsInfo img{
  width:60px;
  height: 60px;
  vertical-align: middle;
}
</style>